// 封装数据库操作
function db(sql,params,callback){
    const mysql = require('mysql');
    const conn = mysql.createConnection({
        host:'localhost',
        user:'root',
        password:'1234',
        database:'books'
    });
    //3. 连接到数据库
    conn.connect();
    conn.query(sql,params,callback);
    conn.end();
}   
module.exports = db;